package com.study.demo;

import cn.hutool.core.lang.UUID;
import cn.hutool.core.net.NetUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;

@Slf4j
@RestController
@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @GetMapping
    @ResponseBody
    public String ip() {
        InetAddress localhost = NetUtil.getLocalhost();
        log.info("系统IP[{}-{}]", localhost.getHostAddress(), localhost);
        System.out.println(localhost.getHostAddress());
        return UUID.fastUUID() + "\t" + localhost;
    }

}
